<%@ page import="com.hhm.pojo.Sex" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link href="/static/css/index2.css" rel="stylesheet">
    <script type="text/javascript" src="/static/js/jquery-3.2.1.js"></script>
    <script>
        //删除
        function updateUser() {

                $.post(
                    "/updateUser",
                    $("form").serialize(),
                    function (msg) {
                        if (msg){
                            alert("修改成功");
                            location.href="/list";
                        }else {
                            alert("修改no");
                        }
                    }
                );
        }

    </script>
</head>
<body>
<form>
   <input type="hidden" name="id" value="${user.id}"/>
    姓名：<input type="text" name="username" value="${user.username}"/><br/>
    密码：<input type="text" name="password" value="${user.password}"/><br/>
    性别：<input type="radio" name="sex" value="MEN" ${user.sex.code==0?"checked":""}/>男
    <input type="radio" name="sex" value="WOMEN" ${user.sex.code==1?"checked":""}/>女<br/>
    手机号：<input type="text" name="telephone" value="${user.telephone}"/><br/>
    生日：<input type="text" name="birthday"
         value="<fmt:formatDate value='${user.birthday}' pattern='yyyy-MM-dd'></fmt:formatDate>"/><br/>
    <button type="button" onclick="updateUser()">修改</button>
</form>
</body>
</html>